<!-- 底部新增 -->

<template>
  <span>
    <BtnDefault title="存草稿" @click="toSave" />
    <BtnPrimary title="发布" @click="toRelease" />
  </span>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'FooterAdd',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb()],

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 点击保存
     */
    async toSave() {
      const { refForm, one, startAdd } = this
      await refForm.check()
      one.status = 1
      startAdd()
    },

    /**
     * 点击发布
     */
    async toRelease() {
      const { refForm, one, startAdd } = this
      await refForm.check()
      one.status = one.publishType === 2 ? 2 : 3
      startAdd()
    },
  },
}
</script>
